{extend name="admin@public/main"}

{block name="button"}
<xblock>
    {if auth("$classuri/add")}
    <button class="layui-btn layui-btn-xs" data-modal='{:url("$classuri/add")}' data-title="添加链接">
        <i class="layui-icon"></i>添加链接
    </button>
    {/if}
    <span class="x-right" style="line-height:40px"></span>
</xblock>
{/block}

{block name="table"}
<table lay-size="sm" class="layui-table">
    <thead>
    <tr>
        <th width="10">id</th>
        <th width="50">链接名称</th>
        <th width="50">链接地址</th>
        <th width="100">状态</th>
        <th width="100">操作</th>
    </tr>
    </thead>
    <tbody>
    {volist name="list" id="vo"}
    <tr>
        <td>{$vo.id}</td>
        <td>{$vo.title}</td>
        <td><a href="{$vo.href}" target="_blank">{$vo.href}</a></td>
        <td>{:$vo.state?'已启用':'已禁用'}</td>
        <td>
            {if auth("$classuri/edit")}
            <button class="layui-btn layui-btn-xs" href="javascript:;" data-title="编辑链接" data-modal='{:url("$classuri/edit")}?id={$vo.id}'>
                编辑
            </button>
            {/if}
            {if auth("$classuri/change")}
            <button class="layui-btn layui-btn-xs layui-btn-{:$vo.state?'warm':'primary'}" href="javascript:;" data-confirm="确定操作该条数据吗？"
                    data-post='{:url("$classuri/change")}' data-param='id={$vo.id}&state={:abs($vo.state-1)}'>
                {:$vo.state?'禁用':'启用'}
            </button>
            {/if}
            {if auth("$classuri/del")}
            <button class="layui-btn layui-btn-xs" href="javascript:;"
               data-confirm="确定要删除吗！" data-post='{:url("$classuri/del")}' data-param='ids={$vo.id}'>
                删除
            </button>
            {/if}
        </td>
    </tr>
    {/volist}
    </tbody>
</table>
{$page|raw}
{/block}

{block name="script"}
<script>

</script>
{/block}